function [cmatrix] = find_cooccurencematrix(Irgb)
Igray=double(rgb2gray(Irgb));

height=size(Igray,1);
width=size(Igray,2);

cmatrix = zeros(256);

for i=1:height
    for j=1:width-1
        current=Igray(i,j);
        next=Igray(i,j+1);
        cmatrix(current+1,next+1)=cmatrix(current+1,next+1)+1;
        cmatrix(next+1,current+1)=cmatrix(next+1,current+1)+1;
    end
end

% %cmatrix(1,1)=0;
% total=sum(sum(cmatrix));
% 
% if total~=0
%     cmatrix=cmatrix./total;
% end

